/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.entities;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Tai Nguyen
 */
public class EstimatedBudget {

    private int campaignID;
    private int saleAmount;
    private float saleTarget;
    private float budgetAllocation;
    private float saleVariance;
    private float budgetVariance;
    private String lastError;

    public boolean validate(String strsaleAmount, String strsaleTarget, String strbudgetAllocation, String strsaleVariance, String strbudgetVariance) {
        Pattern pattern = Pattern.compile("[0-9]+[.]?[0-9]+");
        Matcher m1 = pattern.matcher(strsaleAmount);
        Matcher m2 = pattern.matcher(strsaleTarget);
        Matcher m3 = pattern.matcher(strbudgetAllocation);
        Matcher m4 = pattern.matcher(strsaleVariance);
        Matcher m5 = pattern.matcher(strbudgetVariance);
        if (!m1.matches() || !m2.matches() || !m3.matches() || !m4.matches() || !m5.matches()) {
            setLastError("Please Enter number values!");
            return false;
        }
        return true;
    }

    /**
     * @return the campaignID
     */
    public int getCampaignID() {
        return campaignID;
    }

    /**
     * @param campaignID the campaignID to set
     */
    public void setCampaignID(int campaignID) {
        this.campaignID = campaignID;
    }

    /**
     * @return the saleAmount
     */
    public int getSaleAmount() {
        return saleAmount;
    }

    /**
     * @param saleAmount the saleAmount to set
     */
    public void setSaleAmount(int saleAmount) {
        this.saleAmount = saleAmount;
    }

    /**
     * @return the saleTarget
     */
    public float getSaleTarget() {
        return saleTarget;
    }

    /**
     * @param saleTarget the saleTarget to set
     */
    public void setSaleTarget(float saleTarget) {
        this.saleTarget = saleTarget;
    }

    /**
     * @return the budgetAllocation
     */
    public float getBudgetAllocation() {
        return budgetAllocation;
    }

    /**
     * @param budgetAllocation the budgetAllocation to set
     */
    public void setBudgetAllocation(float budgetAllocation) {
        this.budgetAllocation = budgetAllocation;
    }

    /**
     * @return the saleVariance
     */
    public float getSaleVariance() {
        return saleVariance;
    }

    /**
     * @param saleVariance the saleVariance to set
     */
    public void setSaleVariance(float saleVariance) {
        this.saleVariance = saleVariance;
    }

    /**
     * @return the budgetVariance
     */
    public float getBudgetVariance() {
        return budgetVariance;
    }

    /**
     * @param budgetVariance the budgetVariance to set
     */
    public void setBudgetVariance(float budgetVariance) {
        this.budgetVariance = budgetVariance;
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }
}
